import unittest
from api.base.sys.user.exportExcel import ExportExcel
from api.base.sys.user.queryInfoPage import QueryInfoPage
from tools.read_excel import ReadExcel
import time

read = ReadExcel('./用户信息.xlsx')
export_exc = ExportExcel()
query = QueryInfoPage()


class ExportExcel(unittest.TestCase):
    """导出用户的所有用例"""
    def setUp(self):
        pass

    def test_03_export_Excel(self):
        """导出单个用户的用例"""
        b = []
        export_exc.export_user_info('张三')
        time.sleep(2)

        a = query.query_user('张三')
        for i in a['data']['data']:
            b.append(i['op']['loginCode'])
        print(b)
        d = read.read_col(0, 0)
        d.sort()
        print(d)
        self.assertListEqual(d[1:], b, '我们不一样！')


if __name__ == '__main__':
    unittest.main()
